<?php
// +----------------------------------------------------------------------
// | 07FLYSAAS [基于ThinkPHP5.0开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2025-2035 http://www.07fly.xyz
// +----------------------------------------------------------------------
// | Professional because of focus  Persevering because of happiness
// +----------------------------------------------------------------------
// | Author: 开发人生 <goodkfrs@qq.com>
// +----------------------------------------------------------------------

namespace app\plat\controller;

/**
 * 用户公告管理-控制器
 */
class TenNotifyUser extends PlatBase
{

    /**
     * 用户公告列表=》模板
     * @return mixed|string
     */
    public function show()
    {
        return $this->fetch('show');
    }

    /**
     * 用户公告列表-》json数据
     * @return
     */
    public function show_json()
    {
        $orderby = $this->logicTenNotifyUser->getOrderBy($this->param);
        $where = $this->logicTenNotifyUser->getWhere($this->param);
        $field = 'a.*,n.name,n.content,n.create_user_id';
        $list = $this->logicTenNotifyUser->getTenNotifyUserList($where, $field, $orderby);
        return $list;
    }

    /**
     * 用户公告编辑
     * @return mixed|string
     */
    public function detail()
    {
        $this->logicTenNotifyUser->tenNotifyUserRead($this->param);
        $info = $this->logicTenNotifyUser->getTenNotifyUserInfo(['a.id' => $this->param['id']]);
        $this->assign('info', $info);
        return $this->fetch('detail');
    }

    /**
     * 用户公告标已经读
     * @return mixed|string
     */
    public function read()
    {
        IS_POST && $this->jump($this->logicTenNotifyUser->tenNotifyUserRead($this->param));
    }

    /**
     * 用户公告删除
     */
    public function del()
    {
        $where = empty($this->param['id']) ? ['id' => 0] : ['id' => $this->param['id']];
        $this->jump($this->logicTenNotifyUser->tenNotifyUserDel($where));
    }
}
